/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SessionBeans;

import Entidades.Orderes;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Pedro
 */
@Stateless
public class OrderesFacade extends AbstractFacade<Orderes> {

    @PersistenceContext(unitName = "WebApplicationPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public OrderesFacade() {
        super(Orderes.class);
    }

    public Integer getClient(Orderes O) {
        Query q = null;


        q = (Query) em.createQuery("select c FROM Client c where request_id in :request");
        q.setParameter("request", O.getID());
        System.out.println(q.getFirstResult());
        return q.getFirstResult();

    }
}
